#!/usr/bin/env coffee

# import {dump as footDump} from './_foot'
# import {encrypt} from '../lib/aes'
# import {PING} from './cmd.mjs'
# import {AES_KEY} from '../const/v'
# import {MINUTE} from '../const/time_offset.mjs'
# import {hash} from 'blake3'
#
# MINUTE_1 = MINUTE - 1
#
# nowMinute = =>
#   parseInt(new Date()/60000) - MINUTE_1
#
# export dump = (pk)=>
#   msg = Buffer.concat [
#     pk
#   ]
#   n = 0
#   loop
#     if (n++) % 65536 == 0
#       now = nowMinute()
#       ivlen = parseInt(Math.random()*7) + 7
#       foot = footDump(PING, now, ivlen)
#     r = Buffer.concat [
#       encrypt(
#         AES_KEY
#         ivlen
#         msg
#       )
#       foot
#     ]
#     if 0 == hash(r).readUInt16BE()
#       return r

# begin = new Date() * 1
# console.log dump(Buffer.from("123"))
# cost = (new Date() - begin)/1000
# console.log cost
